#!/usr/bin/python
# -*- coding: UTF-8 -*-
from kptest.config.enum import HostType

from extension.test_logic.DpuLogic import DpuLogic


class DPU2_FUNCTION_053(DpuLogic):
    """
        Name:
            DPU2_FUNCTION_053
        Label:
            sdr信息显示
        PreCondition:

        TestStep:
           soc系统/远程机可以通过带内/外打开DPU soc系统
            带外命令：ipmitool -Ianplus -H <soc_bmc_ip> -U <soc_bmc_user> -P <soc_bmc_user_password> power on
        ExpectedResult:
            A) soc系统/远程机可以通过带内/外打开DPU soc系统
        Parameters:

        Author:
            HK1342
        Last Modified:
            2025/05/09
        Remark:

    """

    # 测试执行前配置等准备操作
    def pre_test_case(self):
        super().pre_test_case()

    # 测试步骤
    def procedure(self):
        self.log_step("Step1: 带外打开SOC系统")
        self.set_dpu_power(status="off")  # 测试打开操作前，先关闭SOC系统，
        self.ping_not_reachable(self.dpu_host.Local_ip)
        self.set_dpu_power(status="on")
        self.ping_until_reachable(self.dpu_host.Local_ip)

    # 测试结束后恢复环境
    def post_test_case(self):
        self.set_dpu_power(status="on")
